import React, { useEffect, useState } from 'react'

export default function App() {
  let [count, setCount] = useState(0)
  let [count2, setCount2] = useState(10)

  useEffect(() => {
    setTimeout(() => {
      setCount(100)
    }, 1000)

    return () => {
      console.log('unmounted')
    }
  }, [])

  useEffect(() => {
    setCount2(count+1)
  }, [count])

  return (
    <div>
      {count} {count2}
      <button onClick={() => setCount(count+1)}>click</button>
    </div>
  )
}
